﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

public partial class UploadPage : System.Web.UI.Page
{
    public static string temp;
    protected void Page_Load(object sender, EventArgs e)
    {
        //DateTime CreateTime = DateTime.Now;
        //string test = CreateTime.ToString();
        int Uid = 2;
        try
        {
            Uid = Convert.ToInt32(Context.Request.Cookies["u_id"].Value);
        }
        catch
        {
            Response.Write("<script>alert('請先登入。');location.href='../index.aspx'; </script>");
            return;
        }
        string test = Uid.ToString();


        //Session["u_id"]
        //Session["u_name"] => 改用這個
        temp = FormsAuthentication.HashPasswordForStoringInConfigFile(test, "sha1");
        //string un = Session["u_name"].ToString();//要改用這個
        //temp = FormsAuthentication.HashPasswordForStoringInConfigFile(un, "sha1");//要改用這個
        Session["CreatePostTime"] = temp;//要砍掉
        //this.Button1.Text = temp;
    }
    protected void Submit_Click(object sender, EventArgs e)
    {
        //Button1.Text = "LOL";
        //Server.Transfer("../index.aspx");

        //上傳
        //todo..

        //訊息+跳轉
        Response.Write("<script>alert('文章發表完成！');location.href='../index.aspx'; </script>");
        return;
        //Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", "alert('加入會員成功！');location.href='../index.aspx';", true);
        //Response.Redirect("../index.aspx");
    }
}